package com.ruoyi.match.service.impl;

import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.match.domain.UserTag;
import com.ruoyi.match.domain.vo.UserInfoVo;
import com.ruoyi.match.mapper.UserTagMapper;
import com.ruoyi.match.service.UserTagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.security.Security;
import java.util.List;

@Service
public class UserTagServiceImpl implements UserTagService {

    @Autowired
    private UserTagMapper userTagMapper;


    @Override
    public int AddUserTag(UserTag userTag) {
        return userTagMapper.AddUserTag(userTag);
    }

    @Override
    public int deleteUserTag(UserTag userTag) {
        return userTagMapper.deleteUserTag(userTag);
    }

    @Override
    public List<UserTag> selectUnChosenTag(Long userId) {
        return userTagMapper.selectUnChosenTag(userId);
    }

    @Override
    public List<UserTag> selectMyTag(Long userId) {
        return userTagMapper.selectMyTag(userId);
    }

    @Override
    public List<UserInfoVo> selectUsersByAllTags(List<Integer> tagIds) {

        int size = tagIds.size();
        System.out.println("tagIds:" + tagIds);
        System.out.println("size:" + size);

        Long userId = SecurityUtils.getUserId();


        return userTagMapper.selectUsersByAllTags(tagIds, size, userId);
    }


}
